const { Sequelize } = require('sequelize');
const config = {
  host: "localhost",
  database: "csvchart",
  username: "root",
  password: "",
  port: 3306
}
const sequelize = new Sequelize( //实例
  config.database,
  config.username,
  config.password,
  {
    host: config.host,
    dialect: "mysql",
    pool: {
      max: 5,//最大连接池连接数量
      min: 0,
      idle: 10000,//如果一个线程10秒内没被使用则释放
    },
    logging: true,//
  }
)
const UserModel = require('./model/user')(sequelize)
const expenseModel = require('./model/expense')(sequelize)
const csvModel = require('./model/csv')(sequelize)

module.exports = {
  sequelize,
  UserModel,
  expenseModel,
  csvModel
}
